﻿#pragma once
#include "Channel.h"
#include "EventLoop.h"
#include <string>
using namespace std;
class EventLoop;
class Dispatcher
{
public:
	Dispatcher(EventLoop* evloop);
	virtual ~Dispatcher();
	// 添加
	virtual int add();
	// 删除
	virtual int remove();
	// 修改
	virtual int modify();
	// 事件监测
	virtual int dispatch(int timeout = 2); // 单位: s
	inline void setChannel(Channel* channel)//设置处理的任务
	{
		m_channel = channel;
	}
protected:
	string m_name = string();
	Channel* m_channel;
	EventLoop* m_evLoop;//获取eventloop实例
};